import java.util.*;


public class Anagram {
    public static void main (String  args[])
    {
        Scanner in =new Scanner (System.in);
        System.out.println("Enter the first string");
        String str1=in.nextLine();
        System.out.println("Enter the second string");
        String str2=in.nextLine();
        char[] arr1=str1.toCharArray();
        char[] arr2=str2.toCharArray();
        Arrays.sort(arr1);
        Arrays.sort(arr2);
        char[] a1 = new char [arr1.length];
        char[] a2 = new char [arr1.length];
        for (int i=0,j=0; i<arr1.length; i++)
        	if ((int)arr1[i]!=32)
        	{
        		a1[j]=arr1[i];
        		j++;
        	}
        for (int i=0,j=0; i<arr2.length; i++)
        	if ((int)arr2[i]!=32)
        	{
        		a2[j]=arr2[i];
        		j++;
        	}
        if (Arrays.equals(a1, a2))
            System.out.println("This is an anagram");
         else
            System.out.println("This is not an anagram");
    }
}
